//
//  ZXZBaseViewController.m
//  zuxianzhi
//
//  Created by tyu on 27.5.24.
//

#import "ZXZBaseViewController.h"

@interface ZXZBaseViewController ()

@end

@implementation ZXZBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];

    [self bac_addUI];
}

- (void)bac_addUI{
    
//    UIImageView *bacBackImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 84)];
//    [self.view addSubview:bacBackImageV];
//    self.bacBackImageV = bacBackImageV;
//    bacBackImageV.userInteractionEnabled = YES;
    
    
    UIView *navView = [[UIView alloc]init];
    [self.view addSubview:navView];
    self.navView = navView;
    navView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 100);
    navView.backgroundColor = [UIColor whiteColor];
    
    
    UILabel *bacTitleLabel =  [[UILabel alloc] initWithFrame:CGRectMake(0, 50, [UIScreen mainScreen].bounds.size.width, 40)];
    [self.navView addSubview:bacTitleLabel];
    self.bacTitleLabel = bacTitleLabel;
    bacTitleLabel.textAlignment = NSTextAlignmentCenter;
    bacTitleLabel.font = [UIFont boldSystemFontOfSize:20];
    
    
    UIButton *bacbBackBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, 50, 40, 40)];
    [self.navView addSubview:bacbBackBtn];
    self.bacbBackBtn = bacbBackBtn;
    [bacbBackBtn bringSubviewToFront:self.view];
    [bacbBackBtn setImage:[UIImage imageNamed:@"back_button"] forState:UIControlStateNormal];

//    bacbBackBtn.hidden = YES;
    [bacbBackBtn addTarget:self action:@selector(bacbBackBtnDidClick) forControlEvents:UIControlEventTouchUpInside];
}

- (void)bacbBackBtnDidClick{
    
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.hidesBottomBarWhenPushed = NO;
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.tabBarController.tabBar.hidden = YES;
    if (self.navigationController.childViewControllers.count == 1) {
        self.tabBarController.tabBar.hidden = NO;
    }

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
